package com.go.where.manager.dao.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;

import org.springframework.stereotype.Repository;

import com.go.where.manager.dao.MsgCustomerRelationDao;
import com.go.where.manager.pojo.MsgCustomerRelation;

@Repository("msgCustomerRelationDao")
public class MsgCustomerRelationDaoImpl extends BaseDaoImpl<MsgCustomerRelation> implements MsgCustomerRelationDao {

	@Override
	public int saveMsgCustomers(List<MsgCustomerRelation> relations) {
		for (MsgCustomerRelation relation : relations) {
			relation.setId(UUID.randomUUID().toString());
		}
		return getSqlSession().insert(getNameSpace() + ".batchInsert", relations);
	}

	@Override
	public List<MsgCustomerRelation> queryRelations(String messageId) {
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("messageId", messageId);
		return getSqlSession().selectList(getNameSpace() + ".queryList", params);
	}

	protected String getNameSpace() {
		return "mybatis.xml.MsgCustomerRelationMapper";
	}

}
